package com.cn.wanxi.controller;

import com.cn.wanxi.entity.ProductTypeEntity;
import com.cn.wanxi.entity.ResultEntity;
import com.cn.wanxi.service.IProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/back/productType")
public class ProductTypeController {
    @Autowired
    private IProductTypeService productTypeService;

    @RequestMapping("/add")
    protected ResultEntity add(ProductTypeEntity productTypeEntity) {
        return productTypeService.add(productTypeEntity);
    }

    @RequestMapping("/del")
    protected ResultEntity delete(ProductTypeEntity productTypeEntity) {
        return productTypeService.delete(productTypeEntity);
    }

    @RequestMapping("/get")
    protected ResultEntity findAll(ProductTypeEntity productTypeEntity) {
        return ResultEntity.success(productTypeService.findAll(productTypeEntity));
    }

    @RequestMapping("/id")
    protected ResultEntity findById(ProductTypeEntity productTypeEntity) {
        return productTypeService.findById(productTypeEntity);
    }

    @RequestMapping("/post")
    protected ResultEntity update(ProductTypeEntity productTypeEntity) {
        return productTypeService.update(productTypeEntity);
    }
}
